import { ColumnGroupType, ColumnType } from "antd/es/table"

import { renderNullableValue, StyledParagraph } from "./venueProfitAndLoss"
import { calAccountStatus } from "./venueProfitLossDaily"

const BusinessVpiCenter = (newFormat: (arg: string) => string): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	playerName: {
		key: "playerName",
		dataIndex: "playerName",
		width: 120,
		render: renderNullableValue("playerName"),
		title: newFormat("label.member_account"),
		align: "center",
		fixed: false
	},
	nickName: {
		key: "nickName",
		dataIndex: "nickName",
		width: 120,
		render: renderNullableValue("nickName"),
		title: newFormat("label.member.nickname"),
		align: "center",
		fixed: false
	},
	proxyReportAccountType: {
		key: "accountType",
		dataIndex: "accountType",
		width: 120,
		render: (_text: any, record: any) => (
			<StyledParagraph $isCurved={false}>
				{newFormat(`label.member.${record.accountType === 1 ? "formal" : "failed"}`)}
			</StyledParagraph>
		),
		title: newFormat("report.account_type"),
		align: "center",
		fixed: false
	},
	proxyReportParentProxyAccount: {
		key: "parentProxyName",
		dataIndex: "parentProxyName",
		width: 120,
		render: renderNullableValue("parentProxyName"),
		title: newFormat("label.report.parent_proxy_name"),
		align: "center",
		fixed: false
	},
	vipParentProxyName: {
		key: "topProxyName",
		dataIndex: "topProxyName",
		width: 120,
		render: renderNullableValue("topProxyName"),
		title: newFormat("member.edit_credit.general_gent"),
		align: "center",
		fixed: false
	},
	proxyReportAccountLockStatus: {
		key: "accountLockStatus",
		dataIndex: "accountLockStatus",
		width: 120,
		render: (_text: any, record: any) => (
			<StyledParagraph $isCurved={true}>{calAccountStatus(newFormat)(record)}</StyledParagraph>
		),
		title: newFormat("report.account_status"),
		align: "center",
		fixed: false
	},
	vipLabelName: {
		key: "labelName",
		dataIndex: "labelName",
		width: 120,
		render: renderNullableValue("labelName"),
		title: newFormat("label.member.label_name"),
		align: "center",
		fixed: false
	},
	vipWindControlName: {
		key: "windControlName",
		dataIndex: "windControlName",
		width: 120,
		render: renderNullableValue("windControlName"),
		title: newFormat("common.risk_control_level"),
		align: "center",
		fixed: false
	},
	proxyReportRegisterAt: {
		key: "registerAt",
		dataIndex: "registerAt",
		width: 120,
		render: renderNullableValue("registerAt"),
		title: newFormat("report.register_dates"),
		align: "center",
		fixed: false
	},
	vipWalletBalance: {
		key: "walletBalance",
		dataIndex: "walletBalance",
		width: 120,
		render: renderNullableValue("walletBalance"),
		title: newFormat("label.report.Wallet_info"),
		align: "center",
		fixed: false
	},
	vipFirstDepositAmount: {
		key: "firstDepositAmount",
		dataIndex: "firstDepositAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("firstDepositAmount", "$")(_text, record)} {renderNullableValue("firstDepositTime")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("label.member.first_deposit")}</p>
				<p>{newFormat("label.member.first_deposit_date_time")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	vipBetCount: {
		key: "betCount",
		dataIndex: "betCount",
		width: 120,
		render: renderNullableValue("betCount"),
		title: newFormat("label.report.bet_count"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.betCount - b.betCount
	},
	vipBetAmount: {
		key: "betAmount",
		dataIndex: "betAmount",
		width: 120,
		render: renderNullableValue("betAmount", "$"),
		title: newFormat("common.game.bet_amount"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.betAmount - b.betAmount
	},
	vipValidBetAmount: {
		key: "validBetAmount",
		dataIndex: "validBetAmount",
		width: 120,
		render: renderNullableValue("validBetAmount", "$"),
		title: newFormat("label.report.valid_bet_amount"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.validBetAmount - b.validBetAmount
	},
	vipNetAmount: {
		key: "netAmount",
		dataIndex: "netAmount",
		width: 120,
		render: (_text: any, record: any) => (
			<div>
				{record.netAmount > 0 ? (
					<span style={{ color: "#D9001B" }}>${`${record.netAmount}`}</span>
				) : record.netAmount < 0 ? (
					<span style={{ color: "#4B7902" }}>${`${record.netAmount}`}</span>
				) : (
					<span>${`${record.netAmount}`}</span>
				)}
			</div>
		),
		title: newFormat("label.report.net_amount"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.netAmount - b.netAmount
	},
	vipMemberRebateAmountByProxy: {
		key: "memberRebateAmountByProxy",
		dataIndex: "memberRebateAmountByProxy",
		width: 120,
		render: renderNullableValue("memberRebateAmountByProxy", "$"),
		title: newFormat("label.report.member_rebate_amount_by_proxy"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.memberRebateAmountByProxy - b.memberRebateAmountByProxy
	},
	vipMemberRebateAmountByPlat: {
		key: "memberRebateAmountByPlat",
		dataIndex: "memberRebateAmountByPlat",
		width: 120,
		render: renderNullableValue("memberRebateAmountByPlat", "$"),
		title: newFormat("label.report.member_rebate_amount_by_plat"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.memberRebateAmountByPlat - b.memberRebateAmountByPlat
	},
	vipOtherAdjustAmount: {
		key: "otherAdjustAmount",
		dataIndex: "otherAdjustAmount",
		width: 120,
		render: renderNullableValue("otherAdjustAmount", "$"),
		title: newFormat("dict.member_patch_add_adjust_type.4.description"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.otherAdjustAmount - b.otherAdjustAmount
	},
	vipNetProfit: {
		key: "netProfit",
		dataIndex: "netProfit",
		width: 120,
		// render: renderNullableValue("netProfit", "$"),
		render: (_text: any, record: any) => (
			<div>
				{record.netProfit > 0 ? (
					<span style={{ color: "#4B7902" }}>${`${record.netProfit}`}</span>
				) : record.netProfit < 0 ? (
					<span style={{ color: "#D9001B" }}>${`${record.netProfit}`}</span>
				) : (
					<span>${`${record.netProfit}`}</span>
				)}
			</div>
		),
		title: newFormat("label.report.net_profit"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.netProfit - b.netProfit
	},
	vipProxyCashUpAmount: {
		key: "proxyCashUpAmount",
		dataIndex: "proxyCashUpAmount",
		width: 120,
		render: renderNullableValue("proxyCashUpAmount", "$"),
		title: newFormat("label.report.proxy_score"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCashUpAmount - b.proxyCashUpAmount
	},
	vipProxyCashUpTimes: {
		key: "proxyCashUpTimes",
		dataIndex: "proxyCashUpTimes",
		width: 120,
		render: renderNullableValue("proxyCashUpTimes"),
		title: newFormat("label.report.proxy_score_times"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCashUpTimes - b.proxyCashUpTimes
	},
	vipProxyCashDownAmount: {
		key: "proxyCashDownAmount",
		dataIndex: "proxyCashDownAmount",
		width: 120,
		render: renderNullableValue("proxyCashDownAmount", "$"),
		title: newFormat("label.report.proxy_points"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCashDownAmount - b.proxyCashDownAmount
	},
	vipProxyCashDownTimes: {
		key: "proxyCashDownTimes",
		dataIndex: "proxyCashDownTimes",
		width: 120,
		render: renderNullableValue("proxyCashDownTimes"),
		title: newFormat("label.report.proxy_points_times"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCashDownTimes - b.proxyCashDownTimes
	},
	vipProxyCreditUpAmount: {
		key: "proxyCreditUpAmount",
		dataIndex: "proxyCreditUpAmount",
		width: 120,
		render: renderNullableValue("proxyCreditUpAmount", "$"),
		title: newFormat("label.report.proxy_credit_up_points"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCreditUpAmount - b.proxyCreditUpAmount
	},
	vipProxyCreditUpTimes: {
		key: "proxyCreditUpTimes",
		dataIndex: "proxyCreditUpTimes",
		width: 120,
		render: renderNullableValue("proxyCreditUpTimes"),
		title: newFormat("label.report.proxy_credit_up_points_times"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCreditUpTimes - b.proxyCreditUpTimes
	},
	vipProxyCreditDownDmount: {
		key: "proxyCreditDownDmount",
		dataIndex: "proxyCreditDownDmount",
		width: 120,
		render: renderNullableValue("proxyCreditDownDmount", "$"),
		title: newFormat("label.report.proxy_credit_down_points"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCreditDownDmount - b.proxyCreditDownDmount
	},
	vipProxyCreditDownTimes: {
		key: "proxyCreditDownTimes",
		dataIndex: "proxyCreditDownTimes",
		width: 120,
		render: renderNullableValue("proxyCreditDownTimes"),
		title: newFormat("label.report.proxy_credit_down_points_times"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyCreditDownTimes - b.proxyCreditDownTimes
	},
	vipProxyHelpCreditRepayAmount: {
		key: "proxyHelpCreditRepayAmount",
		dataIndex: "proxyHelpCreditRepayAmount",
		width: 120,
		render: renderNullableValue("proxyHelpCreditRepayAmount", "$"),
		title: "代理帮信用还款",
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyHelpCreditRepayAmount - b.proxyHelpCreditRepayAmount
	},
	vipProxyHelpCreditRepayTimes: {
		key: "proxyHelpCreditRepayTimes",
		dataIndex: "proxyHelpCreditRepayTimes",
		width: 120,
		render: renderNullableValue("proxyHelpCreditRepayTimes"),
		title: "代理帮信用还款次数",
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.proxyHelpCreditRepayTimes - b.proxyHelpCreditRepayTimes
	},
	vipDepositAmount: {
		key: "depositAmount",
		dataIndex: "depositAmount",
		width: 120,
		render: renderNullableValue("depositAmount", "$"),
		title: newFormat("label.report.deposit_amount"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.depositAmount - b.depositAmount
	},
	vipDepositTimes: {
		key: "depositTimes",
		dataIndex: "depositTimes",
		width: 120,
		render: renderNullableValue("depositTimes"),
		title: newFormat("label.report.deposit_times"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.depositTimes - b.depositTimes
	},
	vipWithdrawAmount: {
		key: "withdrawAmount",
		dataIndex: "withdrawAmount",
		width: 120,
		render: renderNullableValue("withdrawAmount", "$"),
		title: newFormat("label.report.withdraw_amount"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.withdrawAmount - b.withdrawAmount
	},
	vipDepositWithdrawDifferAmount: {
		key: "depositWithdrawDifferAmount",
		dataIndex: "depositWithdrawDifferAmount",
		width: 120,
		render: renderNullableValue("depositWithdrawDifferAmount", "$"),
		title: newFormat("label.report.deposit_withdraw_differ_amount"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.depositWithdrawDifferAmount - b.depositWithdrawDifferAmount
	},
	vipWithdrawTimes: {
		key: "withdrawTimes",
		dataIndex: "withdrawTimes",
		width: 120,
		render: renderNullableValue("withdrawTimes"),
		title: newFormat("report.withdraw_times"),
		align: "center",
		fixed: false,
		sorter: (a: any, b: any) => a.withdrawTimes - b.withdrawTimes
	}
})

export default BusinessVpiCenter
